﻿using System;

namespace HEFramework
{
    public interface ISerialize
    {
    }

    public interface ISerializeSystem : ISystemType
    {
        void Run(Entity _o);
    }


    /// <summary>
    ///
    /// 序列化前执行的System
    /// 
    /// ----------------------------------------
    /// 作者 hep
    /// 创建时间：2023-12-12 10:04:27
    /// ----------------------------------------
    /// </summary>
    [EntitySystem]
    public abstract class SerializeSystem<T> : ISerializeSystem where T : Entity, ISerialize
    {
        Type ISystemType.Type()
        {
            return typeof(T);
        }

        Type ISystemType.SystemType()
        {
            return typeof(ISerializeSystem);
        }

        int ISystemType.GetInstanceQueueIndex()
        {
            return InstanceQueueIndex.None;
        }

        void ISerializeSystem.Run(Entity _o)
        {
            this.Serialize((T)_o);
        }

        protected abstract void Serialize(T _self);
    }
}